package visual;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import java.awt.Rectangle;

import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JTextPane;
import javax.swing.JButton;

import basicas.Acabamento;
import basicas.Cor;
import basicas.Opcional;
import basicas.Veiculo;
import basicas.Versao;

import fachada.Fachada;

import java.awt.GridBagLayout;
import java.sql.SQLException;

public class CadastrarMercadorias extends JPanel {

	private static final long serialVersionUID = 1L;
	Fachada F = new Fachada();  //  @jve:decl-index=0:
	private JTabbedPane jTabbedPane = null;
	private JPanel jPanelCadastroAcabamento = null;
	private JPanel jPanelCadastroCor = null;
	private JPanel jPanelCadastroOpcional = null;
	private JPanel jPanelCadastroVeiculo = null;
	private JPanel jPanelCadastroVersao = null;
	private JPanel jPanelAcabamento = null;
	private JPanel jPanelCor = null;
	private JPanel jPanelOpcional = null;
	private JPanel jPanelVeiculo = null;
	private JPanel jPanelVersao = null;
	private JLabel lblDescricaoAcabamento = null;
	private JTextPane txtPanelDescricaoAcabamento = null;
	private JLabel lblValorAcabamento = null;
	private JTextField txtValorAcabamento = null;
	private JPanel jPanelControlAcab = null;
	private JButton btnNovoAcab = null;
	private JButton jButton = null;
	private JButton btnControlEnviarAcab = null;
	private JLabel jLabel = null;
	private JTextPane txtPaneCor = null;
	private JLabel lblValorCor = null;
	private JTextField txtValorCor = null;
	private JPanel jPanelControlCor = null;
	private JButton btnNovoCor = null;
	private JButton btnLimparCor = null;
	private JButton btnEnviarCor = null;
	private JLabel lblDescricaoOpcional = null;
	private JTextPane txtPaneDescricaoOpcional = null;
	private JTextField txtValorOpcional = null;
	private JLabel lblValorOpcional = null;
	private JPanel jPanelControlOpcional = null;
	private JButton btnNovoOpcional = null;
	private JButton btnLimparOpcional = null;
	private JButton btnEnviarOpcional = null;
	private JLabel lblDescricaoVeiculo = null;
	private JTextPane txtPaneVeiculo = null;
	private JLabel lblPrazoOpcional = null;
	private JTextField txtPrazoOpcional = null;
	private JPanel jPanelControleVeiculo = null;
	private JButton btnNovoVeiculo = null;
	private JButton btnLimparVeiculo = null;
	private JButton btnEnviarVeiculo = null;
	private JLabel lblDescricaoVersao = null;
	private JTextPane txtPaneDescricaoVersao = null;
	private JLabel lblPrecoVersao = null;
	private JTextField txtValorVersao = null;
	private JLabel lblPrazoVersao = null;
	private JTextField txtPrazoVersao = null;
	private JPanel jPanelControlVersao = null;
	private JButton btnNovoVersao = null;
	private JButton btnLimparVersao = null;
	private JButton btnEnviarVersao = null;
	/**
	 * This is the default constructor
	 */
	public CadastrarMercadorias() {
		super();
		initialize();
		desabilitar();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(817, 559);
		this.setLayout(null);
		this.add(getJTabbedPane(), null);
	}

	/**
	 * This method initializes jTabbedPane	
	 * 	
	 * @return javax.swing.JTabbedPane	
	 */
	private JTabbedPane getJTabbedPane() {
		if (jTabbedPane == null) {
			jTabbedPane = new JTabbedPane();
			jTabbedPane.setBounds(new Rectangle(16, 17, 787, 522));
			jTabbedPane.addTab("Cadastro de Acabamentos", null, getJPanelCadastroAcabamento(), null);
			jTabbedPane.addTab("Cadastro de Cores do Veículo", null, getJPanelCadastroCor(), null);
			jTabbedPane.addTab("Cadastro dos Opcionais", null, getJPanelCadastroOpcional(), null);
			jTabbedPane.addTab("Cadastro de Veículos", null, getJPanelCadastroVeiculo(), null);
			jTabbedPane.addTab("Cadastro de Versão dos Veículos", null, getJPanelCadastroVersao(), null);
		}
		return jTabbedPane;
	}

	/**
	 * This method initializes jPanelCadastroAcabamento	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelCadastroAcabamento() {
		if (jPanelCadastroAcabamento == null) {
			jPanelCadastroAcabamento = new JPanel();
			jPanelCadastroAcabamento.setLayout(null);
			jPanelCadastroAcabamento.add(getJPanelAcabamento(), null);
		}
		return jPanelCadastroAcabamento;
	}

	/**
	 * This method initializes jPanelCadastroCor	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelCadastroCor() {
		if (jPanelCadastroCor == null) {
			jPanelCadastroCor = new JPanel();
			jPanelCadastroCor.setLayout(null);
			jPanelCadastroCor.add(getJPanelCor(), null);
			
		}
		return jPanelCadastroCor;
	}

	/**
	 * This method initializes jPanelCadastroOpcional	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelCadastroOpcional() {
		if (jPanelCadastroOpcional == null) {
			jPanelCadastroOpcional = new JPanel();
			jPanelCadastroOpcional.setLayout(null);
			jPanelCadastroOpcional.add(getJPanelOpcional(), null);
		}
		return jPanelCadastroOpcional;
	}

	/**
	 * This method initializes jPanelCadastroVeiculo	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelCadastroVeiculo() {
		if (jPanelCadastroVeiculo == null) {
			jPanelCadastroVeiculo = new JPanel();
			jPanelCadastroVeiculo.setLayout(null);
			jPanelCadastroVeiculo.add(getJPanelVeiculo(), null);
		}
		return jPanelCadastroVeiculo;
	}

	/**
	 * This method initializes jPanelCadastroVersao	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelCadastroVersao() {
		if (jPanelCadastroVersao == null) {
			jPanelCadastroVersao = new JPanel();
			jPanelCadastroVersao.setLayout(null);
			jPanelCadastroVersao.add(getJPanelVersao(), null);
		}
		return jPanelCadastroVersao;
	}

	/**
	 * This method initializes jPanelAcabamento	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelAcabamento() {
		if (jPanelAcabamento == null) {
			lblValorAcabamento = new JLabel();
			lblValorAcabamento.setBounds(new Rectangle(47, 248, 43, 15));
			lblValorAcabamento.setText("Valor:");
			lblDescricaoAcabamento = new JLabel();
			lblDescricaoAcabamento.setBounds(new Rectangle(38, 54, 83, 15));
			lblDescricaoAcabamento.setText("Descrição:");
			jPanelAcabamento = new JPanel();
			jPanelAcabamento.setLayout(null);
			jPanelAcabamento.setBounds(new Rectangle(15, 29, 744, 345));
			
			jPanelAcabamento.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Dados do Acabamento: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
			jPanelAcabamento.add(lblDescricaoAcabamento, null);
			jPanelAcabamento.add(getTxtPanelDescricaoAcabamento(), null);
			jPanelAcabamento.add(lblValorAcabamento, null);
			jPanelAcabamento.add(getTxtValorAcabamento(), null);
			jPanelAcabamento.add(getJPanelControlAcab(), null);
		}
		return jPanelAcabamento;
	}

	/**
	 * This method initializes jPanelCor	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelCor() {
		if (jPanelCor == null) {
			lblValorCor = new JLabel();
			lblValorCor.setBounds(new Rectangle(64, 255, 43, 15));
			lblValorCor.setText("Valor:");
			jLabel = new JLabel();
			jLabel.setBounds(new Rectangle(47, 50, 75, 15));
			jLabel.setText("Descrição:");
			jPanelCor = new JPanel();
			jPanelCor.setLayout(null);
			jPanelCor.setBounds(new Rectangle(10, 31, 748, 374));
			jPanelCor.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Dados da Cor do Veículo: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
			jPanelCor.add(jLabel, null);
			jPanelCor.add(getTxtPaneCor(), null);
			jPanelCor.add(lblValorCor, null);
			jPanelCor.add(getTxtValorCor(), null);
			jPanelCor.add(getJPanelControlCor(), null);
		}
		return jPanelCor;
	}

	/**
	 * This method initializes jPanelOpcional	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelOpcional() {
		if (jPanelOpcional == null) {
			lblPrazoOpcional = new JLabel();
			lblPrazoOpcional.setBounds(new Rectangle(61, 312, 55, 15));
			lblPrazoOpcional.setText("Prazo:");
			lblValorOpcional = new JLabel();
			lblValorOpcional.setBounds(new Rectangle(61, 265, 43, 15));
			lblValorOpcional.setText("Valor:");
			lblDescricaoOpcional = new JLabel();
			lblDescricaoOpcional.setBounds(new Rectangle(47, 51, 83, 15));
			lblDescricaoOpcional.setText("Descrição:");
			jPanelOpcional = new JPanel();
			jPanelOpcional.setLayout(null);
			jPanelOpcional.setBounds(new Rectangle(9, 31, 749, 362));
			jPanelOpcional.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Dados dos Opcionais: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
			jPanelOpcional.add(lblDescricaoOpcional, null);
			jPanelOpcional.add(getTxtPaneDescricaoOpcional(), null);
			jPanelOpcional.add(getTxtValorOpcional(), null);
			jPanelOpcional.add(lblValorOpcional, null);
			jPanelOpcional.add(getJPanelControlOpcional(), null);
			jPanelOpcional.add(lblPrazoOpcional, null);
			jPanelOpcional.add(getTxtPrazoOpcional(), null);
		}
		return jPanelOpcional;
	}

	/**
	 * This method initializes jPanelVeiculo	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelVeiculo() {
		if (jPanelVeiculo == null) {
			lblDescricaoVeiculo = new JLabel();
			lblDescricaoVeiculo.setBounds(new Rectangle(43, 48, 83, 15));
			lblDescricaoVeiculo.setText("Descrição:");
			jPanelVeiculo = new JPanel();
			jPanelVeiculo.setLayout(null);
			jPanelVeiculo.setBounds(new Rectangle(11, 31, 751, 363));
			jPanelVeiculo.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Dados do Veículo: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
			jPanelVeiculo.add(lblDescricaoVeiculo, null);
			jPanelVeiculo.add(getTxtPaneVeiculo(), null);
			jPanelVeiculo.add(getJPanelControleVeiculo(), null);
		}
		return jPanelVeiculo;
	}

	/**
	 * This method initializes jPanelVersao	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelVersao() {
		if (jPanelVersao == null) {
			lblPrazoVersao = new JLabel();
			lblPrazoVersao.setBounds(new Rectangle(64, 312, 51, 15));
			lblPrazoVersao.setText("Prazo:");
			lblPrecoVersao = new JLabel();
			lblPrecoVersao.setBounds(new Rectangle(63, 261, 43, 15));
			lblPrecoVersao.setText("Valor:");
			lblDescricaoVersao = new JLabel();
			lblDescricaoVersao.setBounds(new Rectangle(42, 48, 82, 15));
			lblDescricaoVersao.setText("Descrição:");
			jPanelVersao = new JPanel();
			jPanelVersao.setLayout(null);
			jPanelVersao.setBounds(new Rectangle(11, 31, 755, 346));
			jPanelVersao.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Dados da Versão do Veiculo: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
			jPanelVersao.add(lblDescricaoVersao, null);
			jPanelVersao.add(getTxtPaneDescricaoVersao(), null);
			jPanelVersao.add(lblPrecoVersao, null);
			jPanelVersao.add(getTxtValorVersao(), null);
			jPanelVersao.add(lblPrazoVersao, null);
			jPanelVersao.add(getTxtPrazoVersao(), null);
			jPanelVersao.add(getJPanelControlVersao(), null);
		}
		return jPanelVersao;
	}

	/**
	 * This method initializes txtPanelDescricaoAcabamento	
	 * 	
	 * @return javax.swing.JTextPane	
	 */
	private JTextPane getTxtPanelDescricaoAcabamento() {
		if (txtPanelDescricaoAcabamento == null) {
			txtPanelDescricaoAcabamento = new JTextPane();
			txtPanelDescricaoAcabamento.setBounds(new Rectangle(140, 55, 572, 147));
			txtPanelDescricaoAcabamento.setToolTipText("Digite a descrição do Acabamento interno");

		}
		return txtPanelDescricaoAcabamento;
	}

	/**
	 * This method initializes txtValorAcabamento	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTxtValorAcabamento() {
		if (txtValorAcabamento == null) {
			txtValorAcabamento = new JTextField();
			txtValorAcabamento.setBounds(new Rectangle(136, 245, 146, 19));
			txtValorAcabamento.setToolTipText("Digite aqui o valor unitário");
		}
		return txtValorAcabamento;
	}

	/**
	 * This method initializes jPanelControlAcab	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelControlAcab() {
		if (jPanelControlAcab == null) {
			jPanelControlAcab = new JPanel();
			jPanelControlAcab.setLayout(null);
			jPanelControlAcab.setBounds(new Rectangle(318, 242, 395, 80));
			jPanelControlAcab.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Painel de Controle: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
			jPanelControlAcab.add(getBtnNovoAcab(), null);
			jPanelControlAcab.add(getJButton(), null);
			jPanelControlAcab.add(getBtnControlEnviarAcab(), null);
		}
		return jPanelControlAcab;
	}

	/**
	 * This method initializes btnNovoAcab	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnNovoAcab() {
		if (btnNovoAcab == null) {
			btnNovoAcab = new JButton();
			btnNovoAcab.setBounds(new Rectangle(36, 31, 92, 25));
			btnNovoAcab.setToolTipText("Novo Registro");
			btnNovoAcab.setText("Novo");
			btnNovoAcab.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPanelDescricaoAcabamento.setEditable(true);
					txtValorAcabamento.setEditable(true);
				}
			});
		}
		return btnNovoAcab;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setBounds(new Rectangle(155, 31, 92, 26));
			jButton.setToolTipText("Limpar os dados");
			jButton.setText("Limpar");
			jButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPanelDescricaoAcabamento.setText("");
					txtValorAcabamento.setText("");
				}
			});
		}
		return jButton;
	}

	/**
	 * This method initializes btnControlEnviarAcab	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnControlEnviarAcab() {
		if (btnControlEnviarAcab == null) {
			btnControlEnviarAcab = new JButton();
			btnControlEnviarAcab.setBounds(new Rectangle(273, 31, 92, 26));
			btnControlEnviarAcab.setToolTipText("Enviar os dados");
			btnControlEnviarAcab.setText("Enviar");
			btnControlEnviarAcab.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					
					Acabamento aca = new Acabamento();
					
					aca.setDescricaoAcabamento(txtPanelDescricaoAcabamento.getText());
					aca.setPrecoAcabamento(Float.parseFloat(txtValorAcabamento.getText()));
					
					try {
						F.cadastrarAcabamento(aca);
						JOptionPane.showMessageDialog(null, "Acabamento Cadastrado com sucesso !!!",
								"ConfifureKar - Cadastro de Acabamento",
								JOptionPane.INFORMATION_MESSAGE);
					} catch (ClassNotFoundException e1) {
						e1.printStackTrace();
					} catch (SQLException e1) {

						e1.printStackTrace();
					}
				}
			});
		}
		return btnControlEnviarAcab;
	}

	/**
	 * This method initializes txtPaneCor	
	 * 	
	 * @return javax.swing.JTextPane	
	 */
	private JTextPane getTxtPaneCor() {
		if (txtPaneCor == null) {
			txtPaneCor = new JTextPane();
			txtPaneCor.setBounds(new Rectangle(143, 52, 588, 159));
			txtPaneCor.setToolTipText("Digite a aqui a descrição da Cor");
		}
		return txtPaneCor;
	}

	/**
	 * This method initializes txtValorCor	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTxtValorCor() {
		if (txtValorCor == null) {
			txtValorCor = new JTextField();
			txtValorCor.setBounds(new Rectangle(142, 252, 144, 19));
		}
		return txtValorCor;
	}

	/**
	 * This method initializes jPanelControlCor	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelControlCor() {
		if (jPanelControlCor == null) {
			jPanelControlCor = new JPanel();
			jPanelControlCor.setLayout(null);
			jPanelControlCor.setBounds(new Rectangle(325, 246, 403, 77));
			jPanelControlCor.add(getBtnNovoCor(), null);
			jPanelControlCor.add(getBtnLimparCor(), null);
			jPanelControlCor.add(getBtnEnviarCor(), null);
			jPanelControlCor.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Painel de Controle: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
		}
		return jPanelControlCor;
	}

	/**
	 * This method initializes btnNovoCor	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnNovoCor() {
		if (btnNovoCor == null) {
			btnNovoCor = new JButton();
			btnNovoCor.setBounds(new Rectangle(30, 32, 92, 22));
			btnNovoCor.setText("Novo");
			btnNovoCor.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneCor.setEditable(true);
					txtValorCor.setEditable(true);
				}
			});
		}
		return btnNovoCor;
	}

	/**
	 * This method initializes btnLimparCor	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnLimparCor() {
		if (btnLimparCor == null) {
			btnLimparCor = new JButton();
			btnLimparCor.setBounds(new Rectangle(157, 32, 92, 22));
			btnLimparCor.setText("Limpar");
			btnLimparCor.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneCor.setText("");
					txtValorCor.setText("");
				}
			});
		}
		return btnLimparCor;
	}

	/**
	 * This method initializes btnEnviarCor	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnEnviarCor() {
		if (btnEnviarCor == null) {
			btnEnviarCor = new JButton();
			btnEnviarCor.setBounds(new Rectangle(291, 32, 92, 22));
			btnEnviarCor.setText("Enviar");
			btnEnviarCor.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					Cor cor = new Cor();
					
					cor.setDescricaoCor(txtPaneCor.getText());
					cor.setPrecoCor(Float.parseFloat(txtValorCor.getText()));
					
					try {
						F.cadastrarCor(cor);
						JOptionPane.showMessageDialog(null, "Cor Cadastrado com sucesso !!!",
								"ConfifureKar - Cadastro de Cores",
								JOptionPane.INFORMATION_MESSAGE);
					} catch (ClassNotFoundException e1) {

						e1.printStackTrace();
					} catch (SQLException e1) {

						e1.printStackTrace();
					}
				}
			});
		}
		return btnEnviarCor;
	}

	/**
	 * This method initializes txtPaneDescricaoOpcional	
	 * 	
	 * @return javax.swing.JTextPane	
	 */
	private JTextPane getTxtPaneDescricaoOpcional() {
		if (txtPaneDescricaoOpcional == null) {
			txtPaneDescricaoOpcional = new JTextPane();
			txtPaneDescricaoOpcional.setBounds(new Rectangle(140, 50, 591, 163));
		}
		return txtPaneDescricaoOpcional;
	}

	/**
	 * This method initializes txtValorOpcional	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTxtValorOpcional() {
		if (txtValorOpcional == null) {
			txtValorOpcional = new JTextField();
			txtValorOpcional.setBounds(new Rectangle(136, 263, 104, 19));
		}
		return txtValorOpcional;
	}

	/**
	 * This method initializes jPanelControlOpcional	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelControlOpcional() {
		if (jPanelControlOpcional == null) {
			jPanelControlOpcional = new JPanel();
			jPanelControlOpcional.setLayout(null);
			jPanelControlOpcional.setBounds(new Rectangle(335, 262, 395, 75));
			jPanelControlOpcional.add(getBtnNovoOpcional(), null);
			jPanelControlOpcional.add(getBtnLimparOpcional(), null);
			jPanelControlOpcional.add(getBtnEnviarOpcional(), null);
			jPanelControlOpcional.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Painel de Controle: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
		}
		return jPanelControlOpcional;
	}

	/**
	 * This method initializes btnNovoOpcional	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnNovoOpcional() {
		if (btnNovoOpcional == null) {
			btnNovoOpcional = new JButton();
			btnNovoOpcional.setBounds(new Rectangle(23, 32, 92, 22));
			btnNovoOpcional.setText("Novo");
			btnNovoOpcional.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneDescricaoOpcional.setEditable(true);
					txtValorOpcional.setEditable(true);
					txtPrazoOpcional.setEditable(true);
				}
			});
		}
		return btnNovoOpcional;
	}

	/**
	 * This method initializes btnLimparOpcional	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnLimparOpcional() {
		if (btnLimparOpcional == null) {
			btnLimparOpcional = new JButton();
			btnLimparOpcional.setBounds(new Rectangle(148, 30, 92, 22));
			btnLimparOpcional.setText("Limpar");
			btnLimparOpcional.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneDescricaoOpcional.setText("");
					txtValorOpcional.setText("");
					txtPrazoOpcional.setText("");
				}
			});
		}
		return btnLimparOpcional;
	}

	/**
	 * This method initializes btnEnviarOpcional	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnEnviarOpcional() {
		if (btnEnviarOpcional == null) {
			btnEnviarOpcional = new JButton();
			btnEnviarOpcional.setBounds(new Rectangle(276, 30, 92, 22));
			btnEnviarOpcional.setText("Enviar");
			btnEnviarOpcional.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					Opcional opc = new Opcional();
					Versao ver = new Versao();
					
					int codVersao = 0;
					
					try {
						codVersao = F.valorDaVersao();
					} catch (ClassNotFoundException e2) {
						e2.printStackTrace();
					} catch (SQLException e2) {

						e2.printStackTrace();
					}
					
					ver.setCodVersao(codVersao);
					opc.setVer(ver);
					opc.setDescricaoOpcional(txtPaneDescricaoOpcional.getText());
					opc.setPrecoOpcional(Float.parseFloat(txtValorOpcional.getText()));
					opc.setPrazoOpcional(Integer.parseInt(txtPrazoOpcional.getText()));
					

					
					try {
						F.cadastrarOpcional(opc);
						JOptionPane.showMessageDialog(null, "Opcional Cadastrado com sucesso !!!",
								"ConfifureKar - Cadastro de Opcionais",
								JOptionPane.INFORMATION_MESSAGE);
					} catch (ClassNotFoundException e1) {
						e1.printStackTrace();
					} catch (SQLException e1) {

						e1.printStackTrace();
					}
				}
			});
		}
		return btnEnviarOpcional;
	}

	/**
	 * This method initializes txtPaneVeiculo	
	 * 	
	 * @return javax.swing.JTextPane	
	 */
	private JTextPane getTxtPaneVeiculo() {
		if (txtPaneVeiculo == null) {
			txtPaneVeiculo = new JTextPane();
			txtPaneVeiculo.setBounds(new Rectangle(136, 47, 589, 165));
		}
		return txtPaneVeiculo;
	}

	/**
	 * This method initializes txtPrazoOpcional	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTxtPrazoOpcional() {
		if (txtPrazoOpcional == null) {
			txtPrazoOpcional = new JTextField();
			txtPrazoOpcional.setBounds(new Rectangle(137, 310, 102, 19));
		}
		return txtPrazoOpcional;
	}

	/**
	 * This method initializes jPanelControleVeiculo	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelControleVeiculo() {
		if (jPanelControleVeiculo == null) {
			jPanelControleVeiculo = new JPanel();
			jPanelControleVeiculo.setLayout(null);
			jPanelControleVeiculo.setBounds(new Rectangle(136, 240, 585, 94));
			jPanelControleVeiculo.add(getBtnNovoVeiculo(), null);
			jPanelControleVeiculo.add(getBtnLimparVeiculo(), null);
			jPanelControleVeiculo.add(getBtnEnviarVeiculo(), null);
			jPanelControleVeiculo.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Painel de Controle: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
		}
		return jPanelControleVeiculo;
	}

	/**
	 * This method initializes btnNovoVeiculo	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnNovoVeiculo() {
		if (btnNovoVeiculo == null) {
			btnNovoVeiculo = new JButton();
			btnNovoVeiculo.setBounds(new Rectangle(52, 40, 92, 22));
			btnNovoVeiculo.setText("Novo");
			btnNovoVeiculo.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneVeiculo.setEditable(true);
				}
			});
		}
		return btnNovoVeiculo;
	}

	/**
	 * This method initializes btnLimparVeiculo	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnLimparVeiculo() {
		if (btnLimparVeiculo == null) {
			btnLimparVeiculo = new JButton();
			btnLimparVeiculo.setBounds(new Rectangle(229, 39, 92, 22));
			btnLimparVeiculo.setText("Limpar");
			btnLimparVeiculo.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneVeiculo.setText("");
				}
			});
		}
		return btnLimparVeiculo;
	}

	/**
	 * This method initializes btnEnviarVeiculo	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnEnviarVeiculo() {
		if (btnEnviarVeiculo == null) {
			btnEnviarVeiculo = new JButton();
			btnEnviarVeiculo.setBounds(new Rectangle(410, 41, 92, 22));
			btnEnviarVeiculo.setText("Enviar");
			btnEnviarVeiculo.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					Veiculo vei = new Veiculo();
					
					vei.setDescricaoVeiculo(txtPaneVeiculo.getText());
					
					try {
						F.cadastrarVeiculo(vei);
						JOptionPane.showMessageDialog(null, "Veículo Cadastrado com sucesso !!!",
								"ConfifureKar - Cadastro de Veículo",
								JOptionPane.INFORMATION_MESSAGE);
					} catch (ClassNotFoundException e1) {
						e1.printStackTrace();
					} catch (SQLException e1) {

						e1.printStackTrace();
					}
				}
			});
		}
		return btnEnviarVeiculo;
	}

	/**
	 * This method initializes txtPaneDescricaoVersao	
	 * 	
	 * @return javax.swing.JTextPane	
	 */
	private JTextPane getTxtPaneDescricaoVersao() {
		if (txtPaneDescricaoVersao == null) {
			txtPaneDescricaoVersao = new JTextPane();
			txtPaneDescricaoVersao.setBounds(new Rectangle(137, 46, 597, 164));
		}
		return txtPaneDescricaoVersao;
	}

	/**
	 * This method initializes txtValorVersao	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTxtValorVersao() {
		if (txtValorVersao == null) {
			txtValorVersao = new JTextField();
			txtValorVersao.setBounds(new Rectangle(137, 261, 104, 19));
		}
		return txtValorVersao;
	}

	/**
	 * This method initializes txtPrazoVersao	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTxtPrazoVersao() {
		if (txtPrazoVersao == null) {
			txtPrazoVersao = new JTextField();
			txtPrazoVersao.setBounds(new Rectangle(139, 312, 100, 19));
		}
		return txtPrazoVersao;
	}

	/**
	 * This method initializes jPanelControlVersao	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanelControlVersao() {
		if (jPanelControlVersao == null) {
			jPanelControlVersao = new JPanel();
			jPanelControlVersao.setLayout(null);
			jPanelControlVersao.setBounds(new Rectangle(264, 254, 470, 79));
			jPanelControlVersao.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder("Painel de Controle: "),
					BorderFactory.createEmptyBorder(5, 5, 5, 5)));
			jPanelControlVersao.add(getBtnNovoVersao(), null);
			jPanelControlVersao.add(getBtnLimparVersao(), null);
			jPanelControlVersao.add(getBtnEnviarVersao(), null);
		}
		return jPanelControlVersao;
	}

	/**
	 * This method initializes btnNovoVersao	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnNovoVersao() {
		if (btnNovoVersao == null) {
			btnNovoVersao = new JButton();
			btnNovoVersao.setBounds(new Rectangle(38, 40, 92, 22));
			btnNovoVersao.setText("Novo");
			btnNovoVersao.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneDescricaoVersao.setEditable(true);
					txtValorVersao.setEditable(true);
					txtPrazoVersao.setEditable(true);
				}
			});
		}
		return btnNovoVersao;
	}

	/**
	 * This method initializes btnLimparVersao	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnLimparVersao() {
		if (btnLimparVersao == null) {
			btnLimparVersao = new JButton();
			btnLimparVersao.setBounds(new Rectangle(186, 40, 92, 22));
			btnLimparVersao.setText("Limpar");
			btnLimparVersao.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					txtPaneDescricaoVersao.setText("");
					txtValorVersao.setText("");
					txtPrazoVersao.setText("");
				}
			});
		}
		return btnLimparVersao;
	}

	/**
	 * This method initializes btnEnviarVersao	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnEnviarVersao() {
		if (btnEnviarVersao == null) {
			btnEnviarVersao = new JButton();
			btnEnviarVersao.setBounds(new Rectangle(334, 42, 92, 22));
			btnEnviarVersao.setText("Enviar");
			btnEnviarVersao.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					int codVeiculo = 0;
					Versao ver = new Versao();
					Veiculo vei = new Veiculo();
					
					try {
						codVeiculo = F.valorDoVeiculo();
					} catch (ClassNotFoundException e1) {
						e1.printStackTrace();
					} catch (SQLException e1) {

						e1.printStackTrace();
					}
					
					vei.setCodVeiculo(codVeiculo);
					ver.setVei(vei);
					ver.setDescricaoModelo(txtPaneDescricaoVersao.getText());
					ver.setPrecoModelo(Float.parseFloat(txtValorVersao.getText()));
					ver.setPrazoModelo(Integer.parseInt(txtPrazoVersao.getText()));
					
					try {
						F.cadastrarVersao(ver);
						JOptionPane.showMessageDialog(null, "Versão Cadastrado com sucesso !!!",
								"ConfifureKar - Cadastro de Versão",
								JOptionPane.INFORMATION_MESSAGE);
					} catch (ClassNotFoundException e1) {
						e1.printStackTrace();
					} catch (SQLException e1) {

						e1.printStackTrace();
					}
				}
			});
		}
		return btnEnviarVersao;
	}
	
	public void desabilitar(){
		txtPanelDescricaoAcabamento.setEditable(false);
		txtValorAcabamento.setEditable(false);
		txtPaneCor.setEditable(false);
		txtValorCor.setEditable(false);
		txtPaneDescricaoOpcional.setEditable(false);
		txtPrazoOpcional.setEditable(false);
		txtValorOpcional.setEditable(false);
		txtPaneVeiculo.setEditable(false);
		txtPrazoVersao.setEditable(false);
		txtValorVersao.setEditable(false);
		txtPaneDescricaoVersao.setEditable(false);

	}
	
	public void habilitar(){
		txtPanelDescricaoAcabamento.setEditable(true);
		txtValorAcabamento.setEditable(true);
		txtPaneCor.setEditable(true);
		txtValorCor.setEditable(true);
		txtPaneDescricaoOpcional.setEditable(true);
		txtPrazoOpcional.setEditable(true);
		txtValorOpcional.setEditable(true);
		txtPaneVeiculo.setEditable(true);
		txtPrazoVersao.setEditable(true);
		txtValorVersao.setEditable(true);
		txtPaneDescricaoVersao.setEditable(true);
	}

}  //  @jve:decl-index=0:visual-constraint="7,16"
